package com.yowasa.xiuxian.engine.battle.enemy.strategy;

import com.google.common.collect.Lists;
import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.engine.battle.strategy.BaseSpellStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import com.yowasa.xiuxian.service.helper.BattleHelper;
import com.yowasa.xiuxian.util.RandomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@BS(name = "若陀龙王")
@Order(1006)
@Component
public class RuoTuoLongWang extends BaseSpellStrategy {
    @Autowired
    private BattleHelper battleHelper;

    @Override
    public ElementEnum getElement() {
        return null;
    }

    @Override
    public void action(UserBattleContent first, UserBattleContent second, BattleContent content) {
        int dmg;
        String desc;
        int i = RandomUtil.randomInt(1);
        if (i == 0) {
            int orgAtk = first.getBattleInfo().getAtk();
            int def = second.getBattleInfo().getDef();
            double random = Math.random() + 0.8;
            int atk = (int) (orgAtk * random);
            dmg = battleHelper.calAtk(atk, def);
            desc = RandomUtil.choice(Lists.newArrayList("不让土壤", "古岩龙游","大地撕裂","千里枯朽","鎏金之投","伏龙之尾","地葬之刻"));
        } else {
            int orgAtk = first.getBattleInfo().getSpell();
            int def = second.getBattleInfo().getRes();
            int atk = (int) (orgAtk * 1.2);
            dmg = battleHelper.calSpell(atk, def);
            desc = RandomUtil.choice(Lists.newArrayList("黑曜之坠", "信仰之山","山崩岩殂"));
        }
        battleHelper.autoAction(this, first, second, content, dmg, desc);
    }

    @Override
    public void limit(UserBO user) {
        throw new HandlerException("无法学习妖兽的攻击手段");
    }

    @Override
    public String limitDesc() {
        return "无";
    }

    @Override
    public String desc() {
        return "如同山岳一般长寿的古老巨龙。\n" +
                "在难以追忆的年月里曾与岩港的帝君并肩，但最终反目，遭镇压于黑暗的地底。在无比漫长的岁月中，它的力量渐渐流失，形态也因各种折磨而扭曲。\n" +
                "枷锁的隐隐震响与龙祖低沉的怒吼，同记忆一般在山峦间回荡。\n\n" +
                "物理攻击较为强大 \n" +
                "物理 ：不让土壤,古岩龙游,大地撕裂,千里枯朽,鎏金之投,伏龙之尾,地葬之刻\n" +
                "法术 ：黑曜之坠,信仰之山,山崩岩殂\n\n" +
                "掉落物：\n" +
                "龙王之冕,血玉之枝,鎏金之鳞，山崩岩殂秘籍";
    }


}
